package org.sanm.webSocket;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Message {
    private MessageType messageType;
    private String senderId;
    private String senderName;
    private String targetId;
    private Object content;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime time = LocalDateTime.now();
    private Integer code = 0;

    Message(MessageType messageType, String senderId, String senderName,  String targetId, Object content){
        this.messageType = messageType;
        this.senderId = senderId;
        this.senderName = senderName;
        this.targetId = targetId;
        this.content = content;
    }
}
